package com.fenghuajueli.idiomppp.adapter;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import com.fenghuajueli.idiomppp.ui.fragment.allidiom.AllStoryFragment;
import com.fenghuajueli.idiomppp.ui.fragment.story.IdiomStoryFragment;
import com.fenghuajueli.idiomppp.ui.fragment.yuyanstory.YuYanStoryFragment;


public class CategoryTabPagerAdapter extends FragmentPagerAdapter {


    public CategoryTabPagerAdapter(@NonNull FragmentManager fm, int behavior) {
        super(fm, behavior);
    }

    @NonNull
    @Override
    public Fragment getItem(int position) {
        return getCurrent(position);
    }

    @Override
    public int getCount() {
        return 3;
    }

    private Fragment getCurrent(int position) {
        switch (position) {
            case 0:
                return AllStoryFragment.newInstance();
            case 1:
                return IdiomStoryFragment.newInstance();
            case 2:
                return YuYanStoryFragment.newInstance();
            default:
                return null;
        }
    }
}
